import Vue from 'vue'
import VueRouter from 'vue-router'
import store from './store'
import goodsSupermarket from "./goodsSupermarket"
import jxc from "./jxc"

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/index/home"
  },
  {
    path: "/login",
    name: "登录",
    component: () => import("@/views/login.vue")
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('@/views/index.vue'),
    children: [
      {
        path: "home",
        name: "首页",
        component: () => import("@/views/home.vue"),
      },
      {
        // path: "role",
        path: "role/roles",
        name: "角色管理",
        component: () => import("@/views/roleManagement/roleManagement.vue")
      },
      {
        // path: "jurisdiction",
        path: "perm/perms",
        name: "权限管理",
        component: () => import("@/views/jurisdictionManagement/jurisdiction.vue")
      },
      {
        // path: "adminUser",
        path: "user/admin_user",
        name: "管理员管理",
        component: () => import("@/views/adminUser/adminUser.vue")
      },
      {
        // path: "commonUser",
        path: "user/users",
        name: "普通用户管理",
        meta: { userType: "common" },
        component: () => import("@/views/commonUser/commonUser.vue")
      },
      {
        // path: "menuManagement",
        path: "menu/menus",
        name: "菜单管理",
        component: () => import("@/views/menu/menuList.vue")
      },
      {
        // path: "versionManagement",
        path: "version/versions",
        name: "版本管理",
        component: () => import("@/views/app/app.vue")
      },
      {
        path: "geolocation",
        name: "导航定位",
        component: () => import("@/views/geolocation.vue")
      },
      {
        path: "editor",
        name: "富文本编辑器",
        component: () => import("@/views/editor.vue")
      },
      ...store,
      ...goodsSupermarket,
      ...jxc
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
